package com.xinghou.platform.dao.main.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import com.xinghou.platform.dao.bases.JdbcTemplate;
import com.xinghou.platform.dao.bases.database.CustomerContextHolder;
import com.xinghou.platform.dao.main.ProvinceDAO;
import com.xinghou.platform.model.main.Province;

@Repository
public class ProvinceDAOImpl {/*
	@Resource
	private JdbcTemplate jdbcTemplate;

	@Override
	public Province getNameByCode(String code) throws DataAccessException {
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_READ);
		String sql = "SELECT code,name FROM province WHERE code = ?";
		Province Province = jdbcTemplate.queryForObject(sql, new Object[] { code }, new ProvinceMapper());
		CustomerContextHolder.clearCustomerType();
		return Province;
	}

	private static final class ProvinceMapper implements RowMapper<Province> {
		public Province mapRow(ResultSet rs, int rowNum) throws SQLException {
			Province province = new Province();
			province.setCode(rs.getString("code"));
			province.setName(rs.getString("name"));
			return province;
		}
	}*/
}
